/*
 * 文件名：RecommendedWorksBussinessImpl.java
 * 版权：Copyright 2007-2016 517na Tech. Co. Ltd. All Rights Reserved. 
 * 描述： RecommendedWorksBussinessImpl.java
 * 修改人：yanshu
 * 修改时间：2016年1月26日
 * 修改内容：新增
 */
package com.feichuang.chineseWoodCarving.business.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.feichuang.chineseWoodCarving.business.IRecommendedWorksBussiness;
import com.feichuang.chineseWoodCarving.dao.IRecommendedWorksDao;
import com.feichuang.chineseWoodCarving.model.MPagerRequestVo;
import com.feichuang.chineseWoodCarving.model.MPagerResultVo;
import com.feichuang.chineseWoodCarving.model.MRecommendedWorksVo;
import com.feichuang.chineseWoodCarving.util.StringUtil;

/**
 * TODO 添加类的一句话简单描述.
 * <p>
 * TODO 详细描述
 * <p>
 * TODO 示例代码
 * 
 * <pre>
 * </pre>
 * 
 * @author yanshu
 */
@Component("recommendedWorksBussiness")
public class RecommendedWorksBussinessImpl extends BaseBusinessImpl implements IRecommendedWorksBussiness {

    @Resource(name = "recommendedWorksDao")
    private IRecommendedWorksDao recommendedWorksDao;

    /**
     * {@inheritDoc}.
     */
    @Override
    public MPagerResultVo<MRecommendedWorksVo> selectMRecommendedWorksVoForPage(MPagerRequestVo<MRecommendedWorksVo> pageRequest) {
        // TODO Auto-generated method stub
        MPagerResultVo<MRecommendedWorksVo> pagerResult = new MPagerResultVo<MRecommendedWorksVo>();
        int count = recommendedWorksDao.selectMRecommendedWorksVoCount(pageRequest);
        if (count > 0) {
            int begin = (pageRequest.getCurrentpage() - 1) * pageRequest.getSize();
            pageRequest.setBegin(begin);
            pageRequest.setEnd(pageRequest.getSize());
            List<MRecommendedWorksVo> list = recommendedWorksDao.selectMRecommendedWorksVoForPage(pageRequest);
            pagerResult.setDataInfo(list);
        }
        pagerResult.setTotalCount(count);
        return pagerResult;
    }

    /**
     * {@inheritDoc}.
     */
    @Override
    public boolean insertMRecommendedWorksVo(MRecommendedWorksVo paramIn) {
        // TODO Auto-generated method stub

        return recommendedWorksDao.insertMRecommendedWorksVo(paramIn);
    }

    /**
     * {@inheritDoc}.
     */
    @Override
    public boolean updateMRecommendedWorksVo(MRecommendedWorksVo paramIn) {
        // TODO Auto-generated method stub
        return recommendedWorksDao.updateMRecommendedWorksVo(paramIn);
    }

    /**
     * {@inheritDoc}.
     */
    @Override
    public boolean deleteMRecommendedWorksVo(MRecommendedWorksVo paramIn) {
        // TODO Auto-generated method stub
        if (StringUtil.strIsNullOrEmpty(paramIn.getKeyId())) {
            return false;
        }
        return recommendedWorksDao.deleteMRecommendedWorksVo(paramIn);
    }

}
